package org.example.demo20231101.server.controller;

import lombok.RequiredArgsConstructor;
import org.example.demo20231101.server.controller.vo.UserVO;
import org.example.demo20231101.server.service.UserService;
import org.springframework.web.bind.annotation.*;

/**
 * @version 1.0
 * @Author Lmh
 * @Description
 * @CreateTime 2023-11-01 21:50
 */
@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
public class UserController {

    private final UserService userService;

    @PostMapping("/add")
    public void addUser(@RequestBody UserVO user) {
        userService.add(user);
    }

    @GetMapping("/{id}")
    public UserVO addUser(@PathVariable("id") Long id) {
        return userService.getById(id);
    }

}
